package cn.bdqn.util;
/**
 * 计算分页的工具类，含有分页的四要素
 * @author Administrator
 *
 */
public class PageUtil {
	private Integer pageIndex =1 ;		//当前页
	private Integer pageSize = 0 ;		//页大小
	private Integer totalPages = 1 ;	//总页数
	private Integer totalCount = 0 ;	//总记录数
	
	public Integer getPageIndex() {
		return pageIndex;
	}
	public void setPageIndex(Integer pageIndex) {
		this.pageIndex = pageIndex;
	}
	public Integer getPageSize() {
		return pageSize;
	}
	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}
	public Integer getTotalPages() {
		return totalPages;
	}
	
	public Integer getTotalCount() {
		return totalCount;
	}
	public void setTotalCount(Integer totalCount) {
		if(totalCount > 0){
			this.totalCount = totalCount;
			//计算总页数
			totalPages = (totalCount % pageSize == 0)?(totalCount / pageSize):(totalCount / pageSize +1);
		}
	}
	
	

}
